package cn.sunlight.city.controller;

import cn.sunlight.city.pojo.ChinaCity;
import cn.sunlight.city.pojo.Province;
import cn.sunlight.city.service.ChinaCityService;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/chinaCity")
public class ChinaCityController {

    @Autowired
    private ChinaCityService chinaCityService;

    @GetMapping
    public String findAll(){
        List<ChinaCity> list = chinaCityService.selectAll();
        String data = JSON.toJSONString(list);
        return data;
    }

}
